<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Principal.aspx.cs" Inherits="PresentacionWeb.Principal" MasterPageFile="~/SportifMaterPage.Master" %>
<%@ Reference Control ="~/ControlesDeUsuario/UCViewProducto.ascx"  %>


<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>




<asp:Content ID="Content1" runat="server" 
    contentplaceholderid="ContentPlaceHolderCentral">
     <asp:UpdatePanel ID="UpdatePanel2" runat="server" 
        UpdateMode="Conditional">
                            <ContentTemplate>
                                <asp:PlaceHolder ID="PlaceHolderProductos" runat="server"></asp:PlaceHolder>
                                <asp:GridView ID="gvResultados" runat="server" AllowPaging="True" 
                                    AllowSorting="True" AutoGenerateColumns="False" PageSize="20" 
                                    onselectedindexchanged="gvResultados_SelectedIndexChanged">
                                    <Columns>
                                        <asp:BoundField DataField="ProdId" HeaderText="IdProducto" ReadOnly="True" 
                                            Visible="False" />
                                        <asp:BoundField DataField="ProdNombre" HeaderText="Nombre" ReadOnly="True" />
                                        <asp:BoundField DataField="ProdDescripcion" HeaderText="Descripcion" 
                                            ReadOnly="True" />
                                        <asp:BoundField DataField="ProdPrecio" HeaderText="Precio" ReadOnly="True" />
                                        <asp:HyperLinkField datanavigateurlfields="ProdId" DataTextField="ProdId" 
                                            datatextformatstring="{0:N}"  datanavigateurlformatstring="~\AltaYBusqueda.aspx?ProdId={0}" 
                                            Text="Ver Detalles" HeaderText="Ver Detalles" />
                                        <asp:TemplateField HeaderText="Agregar Al Carrito">
                                            <AlternatingItemTemplate>
                                                Nombre
                                            </AlternatingItemTemplate>
                                            <EditItemTemplate>
                                                Descripcion
                                            </EditItemTemplate>
                                            <FooterTemplate>
                                                Ver Detalles
                                            </FooterTemplate>
                                            <HeaderTemplate>
                                                Precio
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:LinkButton ID="linkBtnAddCarrito" runat="server" 
                                                    onclick="linkBtnAddCarrito_Click">Agregar</asp:LinkButton>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                            </ContentTemplate>
                            <Triggers>
                             
                            </Triggers>
                            
    </asp:UpdatePanel>
     <p>
    

     </p>
</asp:Content>



<asp:Content ID="Content3" runat="server" 
    contentplaceholderid="ContentPlaceHolderMenu">
    <cc1:Accordion ID="Accordion1" runat="server" SelectedIndex="0" FadeTransitions="true" FramesPerSecond="40" TransitionDuration="250" AutoSize="None">
    <Panes>
        <cc1:AccordionPane ID="accBasica" runat="server">
        <Header>
            <a href="" onclick="return false;">Busqueda Basica</a>
        </Header>
        <Content>
        <asp:Panel ID="Panel1" runat="server" BackColor="Azure"  Width="70%">
            
        
        <asp:DropDownList ID="ddlCategorias" runat="server" Height="20px" Width="154px">
            <asp:ListItem Text="Todos" Value="-10"></asp:ListItem>
        </asp:DropDownList>
        
        <asp:TextBox ID="txtBusquedaRapida" runat="server" BorderStyle="Dotted" 
            style="text-align: center" Width="274px"></asp:TextBox>
        &nbsp;&nbsp;
                
        <br />
         </asp:Panel>            
        </Content>
        </cc1:AccordionPane>
        
        <cc1:AccordionPane ID="accAvanzada" runat="server">
        <Header>
            <a href="" onclick="return false;">Busqueda Avanzada</a>
        </Header>
        <Content>
   <%--      <asp:Panel ID="Panel2" runat="server" BackColor="Beige"  Width="70%">
            <asp:PlaceHolder ID="PlaceHolderBusquedaAvanzada" runat="server"></asp:PlaceHolder>
        
        </asp:Panel>       --%>
        <asp:Panel ID="Panel3" runat="server" Width="523px" BackColor="AliceBlue">
    
    <table style="width: 99%;">
    <tr>
    <td colspan="2" align="left">
       <asp:DropDownList ID="ddlCategoriasAvanzadas" runat="server" Height="22px" Width="188px">
       <asp:ListItem Text="Todos" Value="-10"></asp:ListItem>
    </asp:DropDownList>
    </td>
    
    </tr>
        <tr>
            <td>
                <asp:Label ID="Label1" runat="server" Text="Nombre"></asp:Label>
            </td>
            <td class="style1">
                <asp:TextBox ID="txtNombre" runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:Label ID="Label2" runat="server" Text="Codigo"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtCodigo" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Label3" runat="server" Text="Descripcion"></asp:Label>
            </td>
            <td class="style1">
                <asp:TextBox ID="txtDescripcion" runat="server" Width="200px"></asp:TextBox>
            </td>
            <td>
                <asp:Label ID="Label4" runat="server" Text="Precio"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtPrecio" runat="server"></asp:TextBox>
            </td>
        </tr>
        
    </table>
    

</asp:Panel>
        </Content>
        </cc1:AccordionPane>
    </Panes>
    </cc1:Accordion>
    
<br />
    <li>
        <asp:Button ID="btnBuscar" runat="server" Text="Buscar" 
            onclick="btnBuscar_Click" Height="28px" />
        
        &nbsp;&nbsp;&nbsp;
        <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Label ID="lblError" runat="server" Font-Size="Medium" 
    ForeColor="Red"></asp:Label>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnBuscar" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
        
        </li>
        

</asp:Content>




<asp:Content ID="Content4" runat="server" 
    contentplaceholderid="ContentPlaceHolderIzquierdo">
                        <h4 align="center">CATEGORIAS</h4>
				         <asp:TreeView ID="tvCategorias" runat="server" 
        ExpandDepth="0" onselectednodechanged="tvCategorias_SelectedNodeChanged" 
        ShowExpandCollapse="False">
    </asp:TreeView>
    <div>
    
        <asp:Panel ID="PanelAdministracion" runat="server" Visible="false">
        <h4 align="center">ADMINISTRACION
            </h4>
        <asp:HyperLink ID="linkABMUsuarios" runat="server" 
                NavigateUrl="~/AdministracionABMUsuarios.aspx">Administracion de Usuarios</asp:HyperLink>
        
            <br />
        
            <asp:HyperLink ID="linkABMProductos" runat="server" 
                NavigateUrl="~/AdministracionABMProductos.aspx">Administracion de Productos</asp:HyperLink>
            <br />
            <asp:HyperLink ID="linkABMCategorias" runat="server" 
                NavigateUrl="~/AdministracionABMCategorias.aspx">Administracion de Categorias</asp:HyperLink>
            <br />
                    </asp:Panel>
    
    </div>
    
</asp:Content>





<asp:Content ID="Content5" runat="server" 
    contentplaceholderid="ContentPlaceHolderDerecho">
<div class="column-right">
<ul>
<asp:UpdatePanel ID="UpdatePanelLogin" runat="server" UpdateMode="Conditional">
 <ContentTemplate>
    
    <li>
    </li>
    <asp:Panel ID="Panel4" runat="server" Visible="False">
        <asp:Label ID="Label12" runat="server" ForeColor="White" Text="Bienvenido"></asp:Label>
        &nbsp;&nbsp;&nbsp;<asp:Label ID="lblLoginUserName" runat="server" ForeColor="White"></asp:Label>
    </asp:Panel>
     <asp:LinkButton ID="lnkLogOut" runat="server" onclick="LoginStatus1_LoggedOut" 
         Visible="False">LogOut</asp:LinkButton>
<br />
    <asp:Panel ID="PanelLogin" runat="server">
   <h4>
    <asp:HyperLink ID="linkCrearUnUsuario" runat="server" 
        NavigateUrl="~/Registrarse.aspx">Registrarse</asp:HyperLink>
    </h4>
        <h4>
            <asp:Label ID="Label10" runat="server" Text="Usuario"></asp:Label>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:TextBox ID="txtUsuario" runat="server" ForeColor="Black"></asp:TextBox>
            <asp:Label ID="Label11" runat="server" Text="Password"></asp:Label>
            <asp:TextBox ID="txtPassword" runat="server" ForeColor="Black" 
                TextMode="Password"></asp:TextBox>
            <asp:Button ID="btnLogin" runat="server" ForeColor="Black" Height="26px" 
                onclick="btnLogin_Click" Text="Ingresar" 
                Width="88px" />
            <br />
            <br />
            <asp:Label ID="lblErrorLogin" runat="server" ForeColor="Red" Text="Label" 
                Visible="False"></asp:Label>
        </h4>
     </asp:Panel>

        

<asp:Panel ID="PanelCarritoCompleto" runat="server">
       <h4>
    <asp:Label ID="Label13" runat="server" Font-Bold="True" ForeColor="White"
            Text="CARRITO"></asp:Label>
    </h4>
        
        <br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:GridView ID="gvCarrito" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" 
            onselectedindexchanged="gvCarrito_SelectedIndexChanged" BackColor="White">
        </asp:GridView>
        <br />
        <asp:Label ID="Label5" runat="server" Font-Bold="True" Font-Size="Small" 
            ForeColor="White" Text="Total      "></asp:Label>
        &nbsp;<asp:Label ID="Label6" runat="server" Font-Bold="True" ForeColor="White" 
            Text="$  "></asp:Label>
        <asp:Label ID="lblCostoTotal" runat="server" Font-Bold="True" ForeColor="White" 
            Text="0.00"></asp:Label>
        <br />
        
        <br />
        <asp:Button ID="btnUpdateCarrito" runat="server" Font-Size="Smaller" 
            Height="20px" onclick="btnUpdateCarrito_Click" Text="btnUpdateCarrito" 
            Visible="False" />
        
        <asp:Button ID="btnCompra" runat="server" 
            onclick="btnConfirmarCompra_Click" Text="Comprar" />
        <asp:Panel ID="PanelDatosCompra" runat="server" Visible="False">
            <asp:Label ID="Label9" runat="server" ForeColor="White" 
                Text="Ingrese Los Datos de Envio"></asp:Label>
            <br />
            <asp:Label ID="Label7" runat="server" ForeColor="White" Text="Dir. Envio"></asp:Label>
            <asp:TextBox ID="txtDirCompra" runat="server" ForeColor="White"></asp:TextBox>
            <br />
            <asp:Label ID="Label8" runat="server" ForeColor="White" Text="Telefono"></asp:Label>
            &nbsp;
            <asp:TextBox ID="txtTelCompra" runat="server" Width="137px"></asp:TextBox>
            <br />
            <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnConfirmarCompra" runat="server" Height="29px" 
                Text="Confirmar Compra" align="center" onclick="btnConfirmarCompra_Click1" />
        </asp:Panel>
        <br />
        <asp:Label ID="lblErrorCompra" runat="server" ForeColor="Red"></asp:Label>
        <br />
        
    </ContentTemplate>
    </asp:UpdatePanel>
    </asp:Panel>
     </ContentTemplate>
     <Triggers>
      
         <asp:AsyncPostBackTrigger ControlID="btnLogin" EventName="Click" />
      
         <asp:AsyncPostBackTrigger ControlID="lnkLogOut" EventName="Click" />
      
     </Triggers>
     </asp:UpdatePanel>

</ul>
 </div>
</asp:Content>






